<{capture name="header"}>
<{lang_script src="lang.js" app='b2c'}>
<{script src="coms/pager.js" app='desktop'}>
<{script src="coms/datapicker.js"  app='desktop'}>
<{/capture}>
<script>


    /* ***********************************************************************/


var goodsEditFrame = (function(){

 

    /******************************************/
        /*
         *  sign:{
               1:保存并增加相似商品,
               2:保存并返回,
               3:保存当前不返回，
         *    }
         */
   var _form=$('gEditor'),_formActionURL=_form.get('action');

   subShopinfoForm = function (event,sign){
        var _default_disabled_bn = false;
       $$('.class-bn').each(function(item,index){
          if($(item).get('disabled')) {
            _default_disabled_bn = true;
            $(item).set('disabled', false);
          }
       });



    switch (sign){
            case 1:
            
            var target={
                    onComplete:function(){
                        location.reload();
                         if( _default_disabled_bn ) {
                          $$('.class-bn').set('disabled', true);
                        }
                       
                }};
            break;
            case 2:
            var target={
                    onComplete:function(rs){
                        if(JSON.decode(rs).error) {
                            return ;
                        }
                        if(window.opener.finderGroup&&window.opener.finderGroup['<{$env.get.finder_id}>']){
                            window.opener.finderGroup['<{$env.get.finder_id}>'].refresh();
                        }
                        window.close();
                        if( _default_disabled_bn ) {
                          $$('.class-bn').set('disabled', true);
                        }

                    }};
            break;
            case 3:
            var target={           //保存当前
                    onComplete:function(rs){
                        var id = JSON.decode(rs).store_id;
                        if(id > 0){
                            $('newshopinfo-edit-form-GId-input').value =id;
                            $('gEditor-g-type').value ='edit';
                            if( _default_disabled_bn ) {
                            $$('.class-bn').set('disabled', true);
                                }
                          
                        }
                      
                    }};
            break;
       }

       _form.store('target',target);
       _form.fireEvent('submit',new Event(event));

   };
});

goodsEditFrame();

</script>

<form name="gEditor" id="gEditor" method='post'  action="index.php?app=business&ctl=admin_storegrade&act=toAdd">
<input name="__type" value="<{$storegrade.grade_id ? 'edit' : 'add'}>" id="gEditor-g-type" type="hidden">
<div class="tableform">
    <div class="division">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr><th style="width:10%;"><em class="red">*</em><{t}>等级名：<{/t}></th>
        <input name="storegrade[grade_id]" value="<{$storegrade.grade_id}>" id="newshopinfo-edit-form-GId-input" type="hidden" value=$storegrade.grade_id>
        <td><{input type="text" name="storegrade[grade_name]" id="grade_name" size="20" vtype="required" value=$storegrade.grade_name}></td></tr>

        <tr><th style="width:10%;"><{t}>允许发布商品数：<{/t}></th>
        <td><{input vtype="unsignedint" id=goods_num name="storegrade[goods_num]" size="6"  value=$storegrade.goods_num}></td></tr>

        <tr><th style="width:10%;"><{t}>允许发行优惠券数：<{/t}></th>
        <td><{input vtype="unsignedint" id=coupons_num name="storegrade[coupons_num]" size="6"  value=$storegrade.coupons_num}></td></tr>

        <tr><th style="width:10%;"><{t}>可选模板套数：<{/t}></th>
        <td><{input vtype="unsignedint" id=theme_num name="storegrade[theme_num]" size="6"  value=$storegrade.theme_num}></td></tr>

        <tr><th style="width:10%;"><{t}>收费标准：<{/t}></th>
        <td><{input type="money" id=grade_money name="storegrade[grade_money]" size="6"  value=$storegrade.grade_money}></td></tr>
       
        <tr><th style="width:10%;"><em class="red">*</em><{t}>保证金标准：<{/t}></th>
        <td><{input type="money" id=issue_money name="storegrade[issue_money]" size="6"  value=$storegrade.issue_money vtype="required" }></td></tr>
        
        <tr><th style="width:10%;"><em class="red">*</em><{t}>店铺类型：<{/t}></th>
        <td><{input type="select" name="storegrade[issue_type]" options=$issue_type value=$storegrade.issue_type vtype="required" }></td></tr>
        <th><em class="c-red">*</em><{t}>所需经验值<{/t}>：</th>
        <td><{input type="unsigned" name="storegrade[experience]" style="width:50px" size="8" class="_x_input" vtype="required&&number" value=$storegrade.experience}> &nbsp; <span class='notice-inline'><{t}>按经验值升级时店铺经验值达到此标准后会自动升级为当前等级<{/t}></span> &nbsp; </td>
        <tr>
          <th><{t}>是否为该店铺类型默认等级：<{/t}></th>
          <td>
            <{input type="intbool" name="storegrade[default_lv]" value=$storegrade.default_lv }>
            <span class="notice-inline" style="margin:5px 0 0 5px; padding:0"><{t}>如果选择“是”，注册商店成功时，初始等级为当前等级<{/t}></span>&nbsp; <{help}><{t}>该店铺类型默认等级未设置时，当前等级自动设置为默认。<{/t}><{/help}>
          </td>
        </tr>
        <tr><th style="width:10%;"><{t}>需要审核：<{/t}></th>
        <td><{t}>是<{/t}></td></tr>

        <tr><th style="width:10%;"><{t}>店铺备注：<{/t}></th>
        <td> <{input  type='textarea' cols=25 rows=4 id=remark  name="storegrade[remark]" value=$storegrade.remark size="60"}></td></tr>
        </table>
    </div>

</div>
<{capture name="footbar"}>
<table cellspacing="0" cellpadding="0" class="table-action">
      <tbody>
        <tr valign="middle">
        <td>
            <{button label=$___b2c="保存并关闭窗口"|t:'b2c' class="btn-primary" onclick="subShopinfoForm(event,2)"}>
            <{if !$storegrade.grade_id}>
            <{button label=$___b2c="保存并添加相似"|t:'b2c' class="btn-primary" onclick="subShopinfoForm(event,1)"}>
            <{/if}>
            <{button label=$___b2c="保存当前"|t:'b2c' class="btn-primary" onclick="subShopinfoForm(event,3)"}>
            <{assign var=bcclose value=$___b2c='确定退出?'|t:'b2c'}>
            <{assign var=bclose value="关  闭"}>
            <{button label=$___b2c=$bclose|t:'b2c' class="btn-secondary" onclick="if(confirm('{$bcclose}'))window.close()"}>
        </td>
        </tr>
        </tbody>
</table>
<{/capture}>
</form>





